#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#===============================================================================
# Copyright 2011 zod.yslin
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# 
# Author: zod.yslin
# Email: 
# File Name: bytes.py
# Description: 
#   bytes([source[, encoding[, errors]]])   將 source 轉換為 bytes ，若 source 為字串，需提供 encoding ，也就是字串的編碼格式
# Edit History: 
#   2011-09-08    File created.
#===============================================================================
d1 = "!@#你好"
print(type(d1))
d2 = bytes(d1, "utf8")
print(type(d2)) 
print(d2)
for i in d2:
    print(i)
 
d1 = "!@#"
d3 = bytes(d1, "ascii")
print(d3)
for i in d3:
    print(i)
